<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/css/index.css">
</head>
<body>
    帐号：<input type="text" name="" id="account"><br>
    密码：<input type="password" name="" id="password"><br>
    <button onclick="register(event)">注册</button>
</body>
<script>
    const account=document.querySelector('#account')
    const password=document.querySelector('#password')
    function register (event){
        console.log(event);
        fetch('api/user/register',{
            method:'POST',
            body:JSON.stringify({account:account.value,password:password.value}),
            headers:{
                'content-type':"application/json"
            }
        }).then(res=>res.json()).then(res=>{
            console.log(res);
            window.location="http://localhost:3200/login.html";
        })
    }
</script>
</html>